package cn.no7player.util;

import cn.no7player.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * Created by y on 2018/12/8.
 */

public  class BaseUtil {
    /**
     * 生成主键ID
     * @param date
     * @return
     */
    public static String generateKey(Date date) {
        SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss");
        String pre=sdf.format(date);
        String uid = UUID.randomUUID().toString().replaceAll("-", "").toUpperCase();
        return pre + uid.substring(12);
    }
}
